package com.example.piece.vm

import androidx.lifecycle.SavedStateHandle
import com.example.base.ext.LoadingView
import com.example.base.vm.BaseViewModel
import com.example.base.vm.OnSuccess
import com.example.piece.entity.AttentionEntity
import com.example.piece.entity.RecommendEntity
import com.example.piece.net.NetManager
import com.example.piece.repository.DouYinRepository

class DouYinViewModel(savedStateHandle: SavedStateHandle):BaseViewModel<DouYinRepository>(savedStateHandle) {
    override fun createRepository(): DouYinRepository=DouYinRepository()

    /**
     *             1
     * 获取划一划页面的推荐列表数据
     * 此接口没有分页，当你快要滑到底部的时候再次调用此接口即可，后端会做过滤操作
     * @see List<AttentionEntity>
     * @see AttentionEntity

     */
    fun douYinList(loadingView: LoadingView?, onSuccess: OnSuccess<List<AttentionEntity>>) =
        Launch(loadingView) {
            val result = repository.douYinList()
            onSuccess(result)
        }


}